<link rel="stylesheet" href="/assets/home/css/center.css" />


    <!-- 头部 -->
    <div class="user">
        <div class="avatar wow fadeInUp">
            {if condition = "$AutoLogin['avatar'] && is_file('.'.$AutoLogin['avatar'])"}
                <img src="{$AutoLogin.avatar}" />
            {else /}
            <img src="/assets/home/images/avatar.jpg" />
            {/if}
        </div>

        <div class="nickname">{$AutoLogin.nickname}</div>
    </div>

    <!-- 菜单 -->
    <div class="menulist">
        
        <div class="commonly-used">
            <div class="title">常用工具</div>
            <div class="list">
                <div class="item">
                    <a href="{:url('home/business/profile')}">
                        <img src="/assets/home/images/profile.png" alt="">
                        <div class="name">基本资料</div>
                    </a>
                </div>

                <div class="item">
                    <a href="{:url('home/business/subject')}">
                        <img src="/assets/home/images/course.png" alt="">
                        <div class="name">我的课程</div>
                    </a>
                </div>

                {if condition="$AutoLogin.auth=='0'"}
                <div class="item">
                    <a href="{:url('home/business/email')}">
                        <img src="/assets/home/images/email.png" alt="">
                        <div class="name">邮箱认证</div>
                    </a>
                </div>
                {/if}
                
                <div class="item">
                    <a href="{:url('home/coupon/index')}">
                        <img src="/assets/home/images/coupon.png" alt="">
                        <div class="name">我的优惠券</div>
                    </a>
                </div>

                <div class="item">
                    <a href="{:url('home/business/collect')}">
                        <img src="/assets/home/images/collection.png" alt="">
                        <div class="name">我的收藏</div>
                    </a>
                </div>

                <div class="item">
                    <a href="{:url('home/business/likes')}">
                        <img src="/assets/home/images/order_1.png" alt="">
                        <div class="name">我的关注</div>
                    </a>
                </div>

                <div class="item">
                    <a href="{:url('home/business/record')}">
                        <img src="/assets/home/images/record.png" alt="">
                        <div class="name">消费记录</div>
                    </a>
                </div>

                <div class="item">
                    <a href="{:url('home/business/pay')}">
                        <img src="/assets/home/images/recharge.png" alt="">
                        <div class="name">余额充值</div>
                    </a>
                </div>

                <div class="item">
                    <a href="{:url('home/business/contact')}">
                        <img src="/assets/home/images/contact.png" alt="">
                        <div class="name">联系我们</div>
                    </a>
                </div>

                <div class="item" id="logout">
                    <a>
                        <img src="/assets/home/images/logout_1.png" alt="">
                        <div class="name">退出账号</div>
                    </a>
                </div>
            </div>
        </div>

        <div class="promotion">
            <div class="title">推广管理</div>
            <div class="list">
                <div class="item">
                    <a href="{:url('home/team/poster')}">
                        <img src="/assets/home/images/poster.png" alt="">
                        <div class="name">推广海报</div>
                    </a>
                </div>

                <div class="item">
                    <a href="{:url('home/team/index')}">
                        <img src="/assets/home/images/team.png" alt="">
                        <div class="name">我的团队</div>
                    </a>
                </div>

                <div class="item">
                    <a href="{:url('home/team/commission')}">
                        <img src="/assets/home/images/money.png" alt="">
                        <div class="name">提现</div>
                    </a>
                </div>
            </div>
        </div>
    </div>

    <!-- 底部 -->
    <div class="footer">
        <nav class="footer-bar">
            <div class="tab-item  mui-active">
                <a href="{:url('home/index/index')}">
                    <span class="mui-icon mui-icon-home"></span>
                    <span class="mui-tab-label">首页</span>
                </a>
            </div>
            <div class="tab-item">
                <a href="{:url('home/subject/index')}">
                    <span class="mui-icon mui-icon-search"></span>
                    <span class="mui-tab-label">搜索</span>
                </a>
            </div>
            <div class="tab-item">
                <a href="{:url('home/teacher/index')}">
                    <span class="iconfont teacher">&#xe63a;</span>
                    <span class="mui-tab-label">名师</span>
                </a>
            </div>
            <div class="tab-item">
                <a href="{:url('home/business/index')}">
                    <span class="mui-icon mui-icon-contact"></span>
                    <span class="mui-tab-label">我的</span>
                </a>
            </div>
        </nav>
    </div>

<script>
    $('#logout').click(() => {
        mui.confirm(
            '是否确认退出',
            '退出提醒',
            ['确认','取消'],
            //点击确认则res值为0，点击取消则res值为1
            function(res)
            {
                if(res.index === 0)
                {
                    //发送ajax请求
                    $.ajax({
                        url:`{:url('home/index/logout')}`,
                        type:'post',
                        dataType:'json',
                        success:(success) =>
                        {   
                            if(success.code)
                            {
                                mui.toast('退出成功')
                                // 关闭当前窗口
                                $('.mui-popup-backdrop').remove()
                                $('.mui-popup').remove()

                                setTimeout(() => {
                                    location.href = "{:url('home/index/login')}"
                                }, 500)

                                return false;
                            }else
                            {
                                mui.toast(success.msg)
                                // 关闭当前窗口
                                $('.mui-popup-backdrop').remove()
                                $('.mui-popup').remove() 
                            }
                        }, 
                        error: err => console.log(err)
                    })


                    
                }
            }
        )
    })
</script>